package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Survey;
import cn.wolfcode.trip.base.mapper.SurveyMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.ISurveyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SurveyServiceImpl implements ISurveyService {
    @Autowired
    private SurveyMapper surveyMapper;
    @Override
    public int insert(Survey record) {

        return surveyMapper.insert(record);

    }

    @Override
    public PageInfo<Survey> query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Survey> list = surveyMapper.selectForList(qo);
        return new PageInfo<>(list);
    }
}
